﻿
using System;
using UvsChess;

namespace StudentAI
{
    public static class Heuristic
    {
        public static int GetPriority(ChessBoard board, ChessMove move, ChessColor color)
        {
            int pri = 0;
            switch(board[move.To.X,move.To.Y])
            {
                case ChessPiece.Empty:
                    pri = 1;
                    if (board[move.From.X, move.From.Y] == ChessPiece.WhitePawn || board[move.From.X, move.From.Y] == ChessPiece.BlackPawn)
                    {
                        if((move.From.X == 3 || move.From.X == 4) && Math.Abs(move.To.Y - move.From.Y) == 2)
                        {
                            pri += 2;
                        }
                        if ((move.From.X == 1 || move.From.X == 6))
                        {
                            pri++;
                        }
                    }
                    break;
                case ChessPiece.BlackPawn:
                case ChessPiece.WhitePawn:
                    pri = 2;
                    break;
                case ChessPiece.WhiteQueen:
                case ChessPiece.BlackQueen:
                    pri = 4;
                    break;
                case ChessPiece.BlackRook:
                case ChessPiece.WhiteRook:
                    pri = 3;
                    break;
                case ChessPiece.WhiteBishop:
                case ChessPiece.BlackBishop:
                    pri = 3;
                    break;
                case ChessPiece.WhiteKnight:
                case ChessPiece.BlackKnight:
                    pri = 3;
                    break;
                case ChessPiece.WhiteKing:
                case ChessPiece.BlackKing:
                    pri = 5;
                    break;
            }
           
            return pri;
        }
    }
}
